﻿Public Class F18_Du_Tinh

    Private Sub btnthoat_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnthoat.Click
        Me.Close()
    End Sub

    Private Sub F18_Du_Tinh_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        Dim kq As Integer = XL_PhieuThu.ThuNam(Me.Tag, Now.Year) / Now.Month
        If kq = 0 Then
            kq = XL_PhieuThu.ThuNam(Me.Tag, Now.Year - 1) / 12
        End If
        Labeltntb.Text = kq.ToString
    End Sub

    Private Sub btnkq_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnkq.Click
        If tbxtuonglai.Text <> "" Then
            Dim dt As Integer = Integer.Parse(tbxtuonglai.Text)
            If dt <> 0 Then
                Labelkq.Text = dt / Integer.Parse(Labeltntb.Text)
            Else
                Labelkq.Text = 0
            End If
        Else
            MessageBox.Show("Chua nhap so tien du tinh!")
        End If
    End Sub
End Class